package name.jiaosha.air.company.domain;
import java.io.Serializable;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

import javax.persistence.*;

/**
 * The persistent class for the storage_space database table.
 * 
 * @author BEA Workshop
 */
@Entity()
@Table(name="storage_space")
public class StorageSpace  implements Serializable {
	//default serial version id, required for serializable classes.
	private static final long serialVersionUID = 1L;
	private Integer id;
	private String name;
	private Storage storage;

    public StorageSpace() {
    }

	@Id()
	@Column(name="id", unique=true, nullable=false, precision=11)
	public Integer getId() {
		return this.id;
	}
	public void setId(Integer id) {
		this.id = id;
	}

	@Basic()
	@Column(name="name", length=32)
	public String getName() {
		return this.name;
	}
	public void setName(String name) {
		this.name = name;
	}

	//bi-directional many-to-one association to Storage
	@ManyToOne(fetch=FetchType.EAGER)
	@JoinColumn(name="storage_id", referencedColumnName="id")
	public Storage getStorage() {
		return this.storage;
	}
	public void setStorage(Storage storage) {
		this.storage = storage;
	}

	public boolean equals(Object other) {
		if (this == other) {
			return true;
		}
		if (!(other instanceof StorageSpace)) {
			return false;
		}
		StorageSpace castOther = (StorageSpace)other;
		return new EqualsBuilder()
			.append(this.getId(), castOther.getId())
			.isEquals();
    }
    
	public int hashCode() {
		return new HashCodeBuilder()
			.append(getId())
			.toHashCode();
    }   

	public String toString() {
		return new ToStringBuilder(this)
			.append("id", getId())
			.toString();
	}
}